package uk.ac.manchester.tewpl.iceiface.client.model;

import com.extjs.gxt.ui.client.data.BaseModelData;

public class KBDatatypePropertyValueModel extends BaseModelData {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public static final String VALUE = "value";
	public static final String LOCALE = "locale";
	public static final String DATATYPE = "dataType";
	public static final String SHORTENED_VALUE = "shortValue";
	public static final String PROPERTY_URI = "propertyUri";

	public KBDatatypePropertyValueModel() {
		// TODO Auto-generated constructor stub
	}

	public KBDatatypePropertyValueModel(String value, String dataType,
			String locale) {
		setValue(value);
		setLocale(locale);
		setDatatype(dataType);
	}

	/**
	 * @return the value
	 */
	public String getValue() {
		return get(VALUE);
	}

	/**
	 * @param value
	 *            the value to set
	 */
	public void setValue(String value) {
		set(VALUE, value);
		if (value.length() > 200)
			set(SHORTENED_VALUE, value.substring(0, 200) + "...");
		else
			set(SHORTENED_VALUE, value);
	}

	/**
	 * @return the locale
	 */
	public String getLocale() {
		return get(LOCALE);
	}

	/**
	 * @param locale
	 *            the locale to set
	 */
	public void setLocale(String locale) {
		set(LOCALE, locale);
	}

	/**
	 * @return the dataType
	 */
	public String getDatatype() {
		return get(DATATYPE);
	}

	/**
	 * @param dataType
	 *            the dataType to set
	 */
	public void setDatatype(String dataType) {
		set(DATATYPE, dataType);
	}

}
